// mela onlie 购物车界面 订制
import { PureComponent } from "react";
import { Button, Modal,Checkbox,List,Stepper,TabBar,PullToRefresh,ListView} from "antd-mobile"
import { connect } from 'dva';
import { ActivityIndicator } from 'antd-mobile';
import { handleImg, goToPage,handleOSS } from "../../utils/helper";
import { InputItem } from 'antd-mobile';
import {IntlProvider, addLocaleData,FormattedMessage} from 'react-intl';
import localeData from '../../../public/lang/data.json';
import { Row, Col } from 'antd';
import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
import { isNull } from '../../utils/helper';
import ReactDOM from 'react-dom';
import MToast from '../../components/Util/MToast';
const CheckboxItem = Checkbox.CheckboxItem;
const alert = Modal.alert;
const Item = List.Item;
@connect(() => {
  return ({

  })
})
export default class GoodCart extends PureComponent {
  constructor(props) {
    super(props);
    this.state = {
      loading: true,
      cartItems: [],
      currentItem_id: -1,
      currentQuantity: 20,
      checkItem:[],
      ArrItems:[],
      aaItem:[],
      isOn:false,//CheckBox的状态
      checked:false,//checkbox是否选中的状态
      totalPrice1:0,
      isChecked:false,//全选按钮被选中
      onChecked:false,//全选按钮选中的状态
      isButton:true,//买的按钮状态
      selectedTab: 'greenTab',
      isBackground:false,
      isBackground1:false,
      isBackground2:false,
      refreshing: false,
    }
  }
  componentWillMount() {
    let { dispatch, location } = this.props;
    dispatch({
      type: "global/setHeaderTitle",
      payload: {
        title: T(localeData[localStorage.locale].cartTitle),
        path: location.pathname + location.search
      }
    });
this.cartList();


    return;
    setTimeout(() => {
      this.setState({
        loading: false,
        cartItems: [
          {
            item_id: 1,
            img_url: "http://api.ab.appbuilder.saas.upos.it//public/uploads//upos_melarossa/20200303/95f1_2b19_1583239655234.jpg",
            goods_name: "dell 笔记本电脑，韩国KN94口罩医用dell 笔记本电脑，韩国KN94口罩医用dell 笔记本电脑，韩国KN94口罩医用",
            goods_id: 10,
            price: 20.99,
            quantity: 2,
            member_nickname: ""
          }, {
            item_id: 2,
            img_url: "http://api.ab.appbuilder.saas.upos.it//public/uploads//upos_melarossa/20200303/95f1_2b19_1583239655234.jpg",
            goods_name: "dell 笔记本电脑，韩国KN94口罩医用dell 笔记本电脑，韩国KN94口罩医用dell 笔记本电脑，韩国KN94口罩医用",
            goods_id: 10,
            price: 20.99,
            quantity: 2,
            member_nickname: ""
          }, {
            item_id: 3,
            img_url: "http://api.ab.appbuilder.saas.upos.it//public/uploads//upos_melarossa/20200303/95f1_2b19_1583239655234.jpg",
            goods_name: "dell 笔记本电脑，韩国KN94口罩医用dell 笔记本电脑，韩国KN94口罩医用dell 笔记本电脑，韩国KN94口罩医用",
            goods_id: 10,
            price: 20.99,
            quantity: 2,
            member_nickname: ""
          }, {
            item_id: 4,
            img_url: "http://api.ab.appbuilder.saas.upos.it//public/uploads//upos_melarossa/20200303/95f1_2b19_1583239655234.jpg",
            goods_name: "dell 笔记本电脑，韩国KN94口罩医用dell 笔记本电脑，韩国KN94口罩医用dell 笔记本电脑，韩国KN94口罩医用",
            goods_id: 10,
            price: 20.99,
            quantity: 2,
            member_nickname: ""
          }, {
            item_id: 5,
            img_url: "http://api.ab.appbuilder.saas.upos.it//public/uploads//upos_melarossa/20200303/95f1_2b19_1583239655234.jpg",
            goods_name: "dell 笔记本电脑，韩国KN94口罩医用dell 笔记本电脑，韩国KN94口罩医用dell 笔记本电脑，韩国KN94口罩医用",
            goods_id: 10,
            price: 20.99,
            quantity: 2,
            member_nickname: ""
          }, {
            item_id: 6,
            img_url: "http://api.ab.appbuilder.saas.upos.it//public/uploads//upos_melarossa/20200303/95f1_2b19_1583239655234.jpg",
            goods_name: "dell 笔记本电脑，韩国KN94口罩医用dell 笔记本电脑，韩国KN94口罩医用dell 笔记本电脑，韩国KN94口罩医用",
            goods_id: 10,
            price: 20.99,
            quantity: 2,
            member_nickname: ""
          }, {
            item_id: 7,
            img_url: "http://api.ab.appbuilder.saas.upos.it//public/uploads//upos_melarossa/20200303/95f1_2b19_1583239655234.jpg",
            goods_name: "dell 笔记本电脑，韩国KN94口罩医用dell 笔记本电脑，韩国KN94口罩医用dell 笔记本电脑，韩国KN94口罩医用",
            goods_id: 10,
            price: 20.99,
            quantity: 2,
            member_nickname: ""
          }, {
            item_id: 8,
            img_url: "http://api.ab.appbuilder.saas.upos.it//public/uploads//upos_melarossa/20200303/95f1_2b19_1583239655234.jpg",
            goods_name: "dell 笔记本电脑，韩国KN94口罩医用dell 笔记本电脑，韩国KN94口罩医用dell 笔记本电脑，韩国KN94口罩医用",
            goods_id: 10,
            price: 20.99,
            quantity: 2,
            member_nickname: ""
          }, {
            item_id: 9,
            img_url: "http://api.ab.appbuilder.saas.upos.it//public/uploads//upos_melarossa/20200303/95f1_2b19_1583239655234.jpg",
            goods_name: "dell 笔记本电脑，韩国KN94口罩医用dell 笔记本电脑，韩国KN94口罩医用dell 笔记本电脑，韩国KN94口罩医用",
            goods_id: 10,
            price: 20.99,
            quantity: 2,
            member_nickname: ""
          }

        ]
      })
    }, 1000);
    return;
  }
  cartList=()=>{
    let { dispatch, location } = this.props;
    dispatch({
      type: "form/query",
      payload: {
        apiInfo: {
          url: "cart/list",
          params: [
            {
              key: "goods_id",
              value: "-1"
            }
          ]
        },
        callback: (result) => {
          let { data } = result;
          let{cartItems,aaItem}=this.state;
          var checkJson1 = this.state.cartItems
          var checkJson2 = this.state.cartItems

          if(!isNull(data.cart_items)){
            data.cart_items.map((item)=>{
              let itemArr = item;
              itemArr={
                ...item,
                checked: false
              }
              console.log(itemArr)
              checkJson1.push(itemArr);
              this.setState({
                quantityValue:item.quantity
              })
            })
          }else{

          }


          this.setState({
            loading: false,
            cartItems: checkJson1,
            cartItemsArr: data.cart_items
          })
          localStorage.setItem("cartItemsArr",JSON.stringify(checkJson1))
          console.log(cartItems)
        }
      }
    })
  }
  componentDidMount() {

  }
 contains=(arrays, obj)=> {
    let {cartItems}=this.state;
    var i = arrays.length;
    while (i--) {
      if (arrays[i] === obj) {
        arrays.splice(i,1);

      }
    }
    return false;
  }
  handleChangeCheck=(e,i)=>{
    let {isChecked}=this.state;
    let totalPrice = 0;
    let {isOn,cartItems}=this.state
    var newArr=[]
    this.setState({
      isOn:false

    })
    // if(isChecked){
    //   i.checked=false
    // }
    console.log(e.target.checked)
    if(e.target.checked){
      i.checked=true
    }else{
      i.checked=false
    }

    cartItems.map((item)=>{
      if(item.checked){
        console.log("rererer");
        newArr.push(item);
        totalPrice += item.price * item.quantity
        this.setState({
        totalPrice1:totalPrice
        })
      }

    })
    console.log(newArr.length,cartItems.length)
    if(newArr.length==0){
      this.setState({
        totalPrice1:0,
        isButton:true
      })
    }else{
      if(newArr.length==cartItems.length){
        this.setState({
          onChecked:true,
          isButton:false
        })
      }else{
        this.setState({
          onChecked:false,
          isButton:false
        })
      }
    }


    console.log(cartItems);
    localStorage.setItem("cartItems",JSON.stringify(cartItems))
    console.log(localStorage.getItem("cartItems"))

  }
  handleChangeAll=(e)=>{
    let {cartItems,checked,checkItem,totalPrice1,cartItemsArr} = this.state;
    let totalPrice = 0
    console.log(e)
    this.setState({
      isOn:true,
      isChecked:true,
      // cartItemsArr:cartItems
    })
    if(e.target.checked){
      console.log("dgvdfvfbb")
     cartItems.map((item)=>{
          item.checked=true;
        totalPrice += item.price * item.quantity
        this.setState({
          checked:true,
          isButton:false,
          totalPrice1:totalPrice,
          totalPrice2:totalPrice,


        })
      })
      this.setState({
        onChecked:true,
        checkItem:cartItems
      })
      console.log(cartItems)
    }else{
      console.log("dfdfggg")
      cartItems.map((item)=>{
        item.checked=false
        totalPrice= 0
        this.setState({
          checked:false,
          isButton:true,
          totalPrice1:totalPrice
        })
      })
      this.setState({
        checkItem:[],
        onChecked:false
      })
    }

    console.log(cartItems)
    localStorage.setItem("cartItems",JSON.stringify(cartItems))
}
  onRefresh=()=>{
    this.setState({ refreshing: true});
    setTimeout(() => {
     this.cartList()
      this.setState({ refreshing: false });
    }, 600);
    // this.bannerList();

  }
  renderList() {
    let { cartItems,checked,isOn, quantityValue,currentQuantity,} = this.state;
    this.setState({
      isOn:false
    })

    if (!cartItems || cartItems.length == 0) {
      return (
        <div style={{ padding: "40px 0", textAlign: "center", fontSize: "20px", color: "#555" }}>
          {T(localeData[localStorage.locale].goodsDetailCartNoGood)}
        </div>
      )
    }
    else {
      console.log(cartItems,isOn)
      let contents = [];
      return (
        <div>
          {/*<div style={{ padding: "10px", fontSize: "16px", borderBottom: "1px solid #ddd", wordBreak: "break-all", lineHeight: 2 }} className="ellipsis1">*/}
          {/*{localStorage[MI_APP_CODE + "name"]}*/}
          {/*</div>*/}
          <div style={{margin:'0.58em 0 146px'}}>
            {
              cartItems.map((i, k) => {
                let { img_url,goods_name, price, quantity, item_id, } = i;
                let img_url1= i.img_url.split(",")[0]
                console.log(img_url1)
                console.log(checked,quantityValue,currentQuantity,img_url.split(",")[0])
                return (

                  <div key={k}  style={{ padding: "0px 0px 0px 0",background:'#fff',marginBottom:'0.58em',height:'105px' }}>

                    {isOn?<div id={item_id} style={{width:'100%',overflow:'hidden',}}>
                      <div style={{float:'left',width:'88%',paddingTop:'6px'}}>
                        <CheckboxItem key={k}  onChange={(e) => this.handleChangeCheck(e,i)} checked={checked}>
                          <div style={{float:'left',verticalAgain:'middle',width:'4.7em'}}>
                            <img src={handleOSS(img_url1)} alt="" style={{ width: "4.7em",height:"4.7em",borderRadius:'50%',marginRight:'5px'}} />
                          </div>
                          <div style={{width:"61%",float:'left',marginLeft:'1.05em',fontSize:'0.9em'}}>
                            <div className="ellipsis2" style={{width:'100%',padding:'0 10px 0 0',color:'#595867',height:'40px'}}>
                              {goods_name}
                            </div>
                            <div style={{marginTop:'1em',overflow:'hidden'}}>
                              <div style={{float:'left',color:'#F09600',fontWeight:'bold'}}>€ {price}</div>
                              <div style={{float:'right',color:'#9C9BAB',fontWeight:'bold',fontSize:'0.8em'}}>x{quantity}</div>
                            </div>

                          </div>

                        </CheckboxItem>
                      </div>

                      <div onClick={() => {
                        this.setState({
                          visible: true,
                          currentItem_id: item_id,
                          currentQuantity: quantity,
                          isBackground:false,
                          isBackground1:false,
                          isBackground2:false,
                        })
                      }} style={{float:'right',verticalAgain:'middle',width:'10%',paddingTop:'18px'}}>
                        <img src="image/cart_edit.png" alt="" style={{ width: "40px",marginRight:'10px' }} />
                      </div>

                    </div>
                      :
                      <div id={item_id} style={{width:'100%',overflow:'hidden',}}>
                        <div style={{float:'left',width:'88%',paddingTop:'6px'}}>
                          <CheckboxItem key={k}  onChange={(e) => this.handleChangeCheck(e,i)}>
                            <div style={{float:'left',verticalAgain:'middle',width:'4.7em'}}>
                              <img src={handleOSS(img_url1)} alt="" style={{ width: "4.7em",height:"4.7em",borderRadius:'50%',marginRight:'5px'}} />
                            </div>
                            <div style={{width:"61%",float:'left',marginLeft:'1.05em',fontSize:'0.9em'}}>
                              <div className="ellipsis2" style={{width:'100%',padding:'0 10px 0 0',color:'#595867',height:'40px'}}>
                                {goods_name}
                              </div>
                              <div style={{marginTop:'1em',overflow:'hidden'}}>
                                <div style={{float:'left',color:'#F09600',fontWeight:'bold'}}>€ {price}</div>
                                <div style={{float:'right',color:'#9C9BAB',fontWeight:'bold',fontSize:'0.8em'}}>x{quantity}</div>
                              </div>

                            </div>

                          </CheckboxItem>
                        </div>

                        <div onClick={() => {
                          this.setState({
                            visible: true,
                            currentItem_id: item_id,
                            currentQuantity: quantity,
                            isBackground:false,
                            isBackground1:false,
                            isBackground2:false,
                          })
                        }} style={{float:'right',verticalAgain:'middle',width:'10%',paddingTop:'35px'}}>
                          <img src="image/cart_edit.png" alt="" style={{ width: "24px",height:'24px',marginRight:'10px' }} />
                        </div>

                      </div>
                    }

                  </div>

                )
                console.log(quantityValue)
              })
            }
          </div>
        </div>
      )
    }
  }
  onChange = (val,e) => {
    console.log(val.length);
    let value = val;
    const reg1 = /^[0-9]{1,}.{0,1}([0-9]*)?$/;
    const reg = /^(([0-9]{0,})|([0-9]{1,}.{0,1}))([0-9]*)?$/;//匹配 - 号开头的数
    if(val.length==0){
      console.log("yyyy")
      value=1
      this.setState({
        quantityValue: value,
      })
    }
    if ((reg.test(value)) || (reg1.test(value))) {
      console.log("rrr")
      // value =1
      if (value.toString().indexOf(".") == value.length - 1) {
      }
      else if (value.toString().indexOf("-") == 0) {
        if (!isNaN(parseFloat(value))) {
          if (parseFloat(value) == 0) {

          }
          else {
            value = parseFloat(value)
          }
        }
      }
      else if (isNaN(value)) {
        value = parseFloat(value)
      }else if(value==0){
        console.log("ddddddddddddddd")
        value =1
      }
      else if(value>100){
        value=100
      }
      else {
        // value=Number(value)//会把0.0 设置成0 小数点后的0输不进去
      }
      this.setState({
        quantityValue: value,
      })
    }
  };
  suerClick=()=>{
    let { dispatch } = this.props;
    dispatch({
      type: "form/query",
      payload: {
        apiInfo: {
          url: "qry/exec?_c=opreation_log",
          params: [
            {
              "key": "opreation_info",
              "value":"确认下单按钮"
            },
            {
              "key": "opreation_id",
              "value":"4"
            }
          ]
        },
        callback: (result) => {
            console.log(result)
        }
      }
    })
  }
  orderClick=() => {
    let { dispatch } = this.props;
    let {cartItems} = this.state;
    this.suerClick();
    localStorage.setItem("cartItems",JSON.stringify(cartItems))
  goToPage({ dispatch, config: { url: "/way" }, isReplace: false })
}
  deleteCarItem = (item_id) => {
    let { cartItems } = this.state;
    let { dispatch } = this.props;
    let newCarItems = cartItems.filter(i => i.item_id != item_id);
    this.setState({
      cartItems: newCarItems,
      visible: false,
      // onClose:false
    })
    // MToast.info("商品删除成功", 1, null, 0)
    // return;
    dispatch({
      type: "form/query",
      payload: {
        apiInfo: {
          url: "cart/delete",
          params: [
            {
              key: "item_id",
              value: item_id
            }
          ]
        },
        callback: (result) => {

        }
      }
    })
  }
  //修改当前state中的购物车数据 掉接口往购物车修改数据
  changeCartItemNumber = () => {
    let { dispatch } = this.props;
    let { currentItem_id, currentQuantity, cartItems, quantityValue, } = this.state;
    console.log(currentItem_id, currentQuantity, cartItems,quantityValue);
    // if (isNull(quantityValue) || quantityValue == 0) {
    //   // 删除商品
    //   this.deleteCarItem(currentItem_id);
    // }
      let newCarItems = cartItems.map(i => {
        if (i.item_id == currentItem_id) {
          return {
            ...i,
            quantity: quantityValue
          }
        }
        else {
          return {
            ...i
          }
        }

      })
      this.setState({
        cartItems: newCarItems
      })
      console.log(cartItems)
      dispatch({
        type: "form/query",
        payload: {
          apiInfo: {
            url: "cart/update/quantity",
            params: [
              {
                key: "item_id",
                value: currentItem_id
              },
              {
                key: "quantity",
                value: quantityValue
              }
            ]
          },
          callback: (result) => {

          }
        }
      })
  }
  render() {
    let { dispatch } = this.props;
    let { loading, cartItems, currentQuantity, currentItem_id,isOn,totalPrice1,onChecked,isButton,isBackground,isBackground1,isBackground2 } = this.state;
    const messages = localeData[localStorage.locale];
    if (loading) {
      return (
        <div className="normal">
          <ActivityIndicator toast text="正在加载" animating={true} />
        </div>
      )
    }

      let totalPrice=0

    cartItems.map((item)=>{
      if(item.checked){
        totalPrice += item.price * item.quantity
        this.setState({
          totalPrice1:totalPrice
        })
      }

    })

    return (
      <IntlProvider
        locale={ localStorage.locale } messages={messages}
      >
      <div className="normal" style={{ background: "#fff", minHeight: "100%" }}>
        <div style={{marginBottom:"40px"}}>
          {this.renderList()}
        </div>

        {
          cartItems && cartItems.length > 0 &&
          <div style={{position: "fixed", bottom: '9%', width: "100%", borderTop: "1px solid #ddd", background: "#fff",zIndex:"2", }}>
            <div style={{ fontSize: "14px",marginTop:'8px' }}>
              <CheckboxItem  onChange={(e) => this.handleChangeAll(e)} checked={onChecked} style={{paddintLeft:'5px',color:'#F09600'}}>
                {messages.cartCheck}<span style={{marginLeft:'7%',display:'inline-block',fontSize:'16px',color:'#2E2D35',fontWeight:'bold',}}>{messages.cartSub}</span><span style={{ color: "#F09600",fontSize:'20px',fontWeight:'bold',marginLeft:'0.5em' }}>€ {totalPrice1.toFixed(2)}</span>
              </CheckboxItem>

            </div>

            <Button  type="primary" size="default" style={{padding: "0 10px", background:'#F09600', fontSize: "18px",width:'15.5em',margin:'1em auto 0.59em',borderRadius:'15px',border:'0px' }} onClick={this.orderClick} disabled={isButton}>{messages.cartConfirm}</Button>

          </div>

        }
        <div style={{position:'fixed',bottom:'0px',left:'0px',width:'100%'}}> <TabBar
          unselectedTintColor="#949494"
          tintColor="#F09600"
          barTintColor="white"
          hidden={this.state.hidden}
        >
          <TabBar.Item
            title={messages.home}
            key="Life"
            icon={<div style={{
              width: '24px',
              height: '24px',
              background: 'url(image/home2.png) center center /  21px 21px no-repeat' }}
            />
            }
            selectedIcon={<div style={{
              width: '24px',
              height: '24px',
              background: 'url(image/home3.png) center center /  21px 21px no-repeat' }}
            />
            }
            selected={this.state.selectedTab === 'redTab'}
            onPress={() => {
              this.setState({
                selectedTab: 'redTab',
              });
              goToPage({ dispatch, config: { url: "/shop_home" }, isReplace: false })
            }}
            data-seed="logId"
          >

          </TabBar.Item>
          <TabBar.Item
            icon={
              <div style={{
                width: '24px',
                height: '24px',
                background: 'url(image/category.png) center center /  21px 21px no-repeat' }}
              />
            }
            selectedIcon={
              <div style={{
                width: '24px',
                height: '24px',
                background: 'url(image/category1.png) center center /  21px 21px no-repeat' }}
              />
            }
            title={messages.category}
            key="Koubei"

            selected={this.state.selectedTab === 'blueTab'}
            onPress={() => {
              this.setState({
                selectedTab: 'blueTab',
              });
              goToPage({ dispatch, config: { url: "/category" }, isReplace: false })
            }}
            data-seed="logId1"
          >

          </TabBar.Item>
          <TabBar.Item
            icon={
              <div style={{
                width: '24px',
                height: '24px',
                background: 'url(image/cart4.png) center center /  21px 21px no-repeat' }}
              />
            }
            selectedIcon={
              <div style={{
                width: '24px',
                height: '24px',
                background: 'url(image/cart5.png) center center /  21px 21px no-repeat' }}
              />
            }
            title={messages.cart}
            key="Friend"
            selected={this.state.selectedTab === 'greenTab'}
            onPress={() => {
              this.setState({
                selectedTab: 'greenTab',
              });
              goToPage({ dispatch, config: { url: "/goodcart" }, isReplace: false })
            }}
          >
          </TabBar.Item>
          <TabBar.Item
            icon={{ uri: 'image/my.png' }}
            selectedIcon={{ uri: 'image/my1.png' }}
            title={messages.my}
            key="my"
            selected={this.state.selectedTab === 'yellowTab'}
            onPress={() => {
              this.setState({
                selectedTab: 'yellowTab',
              });
              goToPage({ dispatch, config: { url: "/my" }, isReplace: false })
            }}

          >

          </TabBar.Item>
        </TabBar></div>
        <Modal
          popup
          visible={this.state.visible}
          onClose={() => {
            this.setState({
              visible: false
            })
          }}
          animationType="slide-up"
          afterClose={() => { }}
        >
          <div style={{  }}>
            <Row style={{padding: "5% 10% 5%",background:isBackground?'#f0f2f5':'#fff'}}
              onClick={() => {
                this.setState({ visible2: true,
                  quantityValue: currentQuantity,
                  isBackground:true,
                  isBackground1:false,
                  isBackground2:false,
                })}}>
              <Col span={2} style={{marginRight:'2%'}}><img src="image/cart_edit.png" style={{width:'24px',height:'24px'}}/></Col>
              <Col span={19}  style={{color:'#2E2D35',fontSize:"16px",textAlign:'left',padding:'0 5%'}}>{T(messages.cartNum)}</Col>
            </Row>
            <Row style={{padding: "5% 10% 5%",background:isBackground1?'#f0f2f5':'#fff'}} onClick={() => {
              this.setState({
                isBackground:false,
                isBackground1:true,
                isBackground2:false,
              })
              this.deleteCarItem(currentItem_id)
            }}>
              <Col span={2} style={{marginRight:'2%'}}><img src="image/delete_24.png" style={{width:'24px',height:'24px'}}/></Col>
              <Col span={19}  style={{color:'#2E2D35',fontSize:"16px",textAlign:'left',padding:'0 5%'}}>{T(messages.cartDel)}</Col>
            </Row>
            <Row style={{padding: "5% 10% 5%",background:isBackground2?'#f0f2f5':'#fff'}} onClick={() => {
              this.setState({
                visible: false,
                isBackground:false,
                isBackground1:false,
                isBackground2:true,
              })
            }}>
              <Col span={2} style={{marginRight:'2%'}}><img src="image/delete_normal.png" style={{width:'24px',height:'24px'}}/></Col>
              <Col span={19}  style={{color:'#2E2D35',fontSize:"16px",textAlign:'left',padding:'0 5%'}}>{T(messages.myModelCancel)}</Col>
            </Row>
          </div>
        </Modal>
        {
          this.state.visible2 && <Modal
            visible={this.state.visible2}
            transparent
            maskClosable={false}
            title=""
            footer={
              [
                { text: T(messages.myModelCancel), onPress: () => { this.setState({ visible2: false }) } },
                {
                  text: T(messages.myModelSure), onPress: () => {
                  this.changeCartItemNumber();
                  this.setState({ visible2: false,visible:false,isBackground:false,
                    isBackground1:false,
                    isBackground2:false, })
                }
                }
              ]
            }
            afterClose={() => { }}
          >
            <div data-flex="box:first cross:center">
              <div style={{ width: "60px" }}>{T(messages.quantity)}：</div>
              <InputItem placeholder="" type="number" onChange={this.onChange} defaultValue={this.state.currentQuantity}></InputItem>
            </div>
          </Modal>
        }

      </div>
  </IntlProvider>
    )
  }
}
